import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Mainframe extends JFrame {
    private static final Color bc = new Color(12, 88, 218);
    private static final Color foreg = new Color(255, 255, 255);
    private static final Font font = new Font("微软雅黑", Font.PLAIN, 19);
    private static final Font trapfont = new Font("微软雅黑", Font.PLAIN, 15);
    private Container c = getContentPane();
    private JLabel purpose1 = new JLabel("你好，欢迎来到User Inyerface: Java Edition！");
    private JLabel purpose2 = new JLabel("它诞生的目的是为了探索客户端UI交互能力的极限。");
    private JLabel purpose3 = new JLabel("要开始的话，只需要填充所有的表格，越快、越准越好！");
    private JPanel main_panel = new JPanel();
    private JPanel butt_panel = new JPanel();
    private JButton butt = new CircleButton("NO");
    private JLabel label = new JLabel("<html>请<u>点击</u></html>");
    private JLabel label_true = new JLabel("此处");
    private JLabel label_highlight = new JLabel("<html>去往<font color='aqua'>下一页</font></html>");
    private JPanel tlabel_panel = new JPanel();
    private JPanel label_panel = new JPanel();
    public Mainframe() {
        super("User Inyerface - Start Page");
        initialize();
    }
    private void initialize() {
        init_frame();
        init_layout();
        init_text();
        init_trap();
        init_action_listener();
        c.add(main_panel);
        repaint();
        revalidate();
    }
    private void init_frame() {
        setSize(640, 480);
        setVisible(true);
        setResizable(false);
        setDefaultCloseOperation(3);
    }
    private void init_layout() {
        c.setBackground(Mainframe.bc);
        c.setLayout(new FlowLayout());
        main_panel.setBackground(Mainframe.bc);
        main_panel.setLayout(new BoxLayout(main_panel, BoxLayout.Y_AXIS));
    }
    private void init_text() {
        add_gasp();
        add_purpose1();
        add_purpose2();
        add_purpose3();
    }
    private void add_purpose1() {
        purpose1.setFont(Mainframe.font);
        purpose1.setForeground(Mainframe.foreg);
        main_panel.add(purpose1);
        add_gasp();
    }
    private void add_purpose2() {
        purpose2.setFont(Mainframe.font);
        purpose2.setForeground(Mainframe.foreg);
        main_panel.add(purpose2);
        add_gasp();
    }
    private void add_purpose3() {
        purpose3.setFont(Mainframe.font);
        purpose3.setForeground(Mainframe.foreg);
        main_panel.add(purpose3);
        add_gasp();
    }
    private void add_gasp() {
        main_panel.add(Box.createVerticalStrut(20));
    }
    private void init_trap() {
        init_trap_button();
        init_trap_text();
    }
    private void init_trap_button() {
        butt.setPreferredSize(new Dimension(100, 100));
        butt.setFont(Mainframe.font);
        butt.setForeground(Color.WHITE);
        butt_panel.setBackground(Mainframe.bc);
        butt_panel.setLayout(new FlowLayout());
        butt_panel.add(butt);
        add_gasp();
        main_panel.add(butt_panel);
    }
    private void init_trap_text() {
        add_gasp();
        add_gasp();
        label.setFont(Mainframe.trapfont);
        label.setForeground(Color.WHITE);
        label_true.setFont(Mainframe.trapfont);
        label_true.setForeground(Color.WHITE);
        label_highlight.setFont(Mainframe.trapfont);
        label_highlight.setForeground(Color.WHITE);
        tlabel_panel.setBackground(Mainframe.bc);
        tlabel_panel.setLayout(new BoxLayout(tlabel_panel, BoxLayout.X_AXIS));
        tlabel_panel.add(label);
        tlabel_panel.add(label_true);
        tlabel_panel.add(label_highlight);
        label_panel.setBackground(Mainframe.bc);
        label_panel.setLayout(new FlowLayout());
        label_panel.add(tlabel_panel);
        main_panel.add(label_panel);
    }
    private void init_action_listener() {
        label_true.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                new PageOne();
                Mainframe.this.dispose();
            }
        });
    }
    public static void main(String[] args) {
        new Mainframe();
    }
}